import { EntityModel } from '@midwayjs/orm';
import { Column } from 'typeorm';
import { BaseEntity } from '@cool-midway/core';

/**
 * 装修页面
 */
@EntityModel('magic')
export class MagicEntity extends BaseEntity {
  @Column({ comment: '微页面标题', type: 'varchar' })
  title: string;

  @Column({ comment: '微页面名称', default: '新建微页面' })
  name: string;

  @Column({ comment: '封面', type: 'text', nullable: true })
  images: string;

  @Column({
    comment: '排序',
    name: 'sort',
    type: 'int',
    nullable: true,
  })
  sort: number;

  @Column({
    comment: '是否启用',
    type: 'tinyint',
    nullable: true,
    default: 0,
  })
  status: number;

  @Column({
    comment: '背景色',
    type: 'varchar',
    nullable: true,
    default: '#f7f7f7',
  })
  background: string;

  @Column({
    comment: '导航栏背景色',
    name: 'nav_background',
    type: 'varchar',
    default: '#fff',
    nullable: true,
  })
  navBackground: string;

  @Column({
    comment: '导航栏背景透明（1：透明  ，0：不透明）',
    type: 'tinyint',
    name: 'nav_type',
    nullable: true,
    default: 0,
  })
  navType: number;

  @Column({ comment: '内容', type: 'longtext', nullable: true })
  content: string;

  @Column({ nullable: true, name: 'target_id', comment: '目的地ID' })
  targetId: number;

  @Column({
    nullable: true,
    name: 'magic_key',
    comment: '页面Key index,user,cart,about,user,agreement,copyright',
  })
  magicKey: string;

  @Column({
    nullable: true,
    default: 2,
    name: 'is_top',
    type: 'tinyint',
    comment: 'key + isTop 就是当前页key 1=置顶',
  })
  isTop: number;

  @Column({
    nullable: true,
    default: 'magic',
    name: 'type',
    comment: 'goods:商品， route：线路 ， magic:魔法页面',
  })
  type: string;

  @Column({
    comment: '展示优惠券弹窗（1：展示  ，0：不展示）',
    type: 'tinyint',
    name: 'show_coupon',
    nullable: true,
    default: 0,
  })
  showCoupon: number;

  @Column({
    default: 'default',
    name: 'source',
    comment: '来源渠道',
  })
  source: string;

  @Column({ nullable: true, comment: '头部js', name: 'header_script' })
  headerScript: string;

  @Column({ nullable: true, comment: 'footer', name: 'footer_tag' })
  footerScript: string;

  @Column({ nullable: true, comment: '属性' })
  attributes: string;
}
